home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / comm / mail / YAT.lha / YAT / Install / Developer / Component.cxx next >
Encoding:
C/C++ Source or Header  |  2000-07-30  |  1.1 KB  |  57 lines

  1. #include <string.h>
  2. #include <stdio.h>
  3. #include <proto/dos.h>
  4.  
  5. STRPTR    version="$VER:Component 1.3 (04.07.100)";
  6. STRPTR    usage="USAGE:m Component FILENAME/A,DEVICE/S,PATH/S,DRAWER/S,NAME/S,EXT/S,NOEXT/S";
  7. STRPTR    temp=&usage[30];
  8.  
  9. #include "dos_comp.cxx"
  10.  
  11. enum    action{filename,device,path,drawer,name,extension,noext};
  12.  
  13. int        main(int argc, char** argv)
  14. {
  15.     if (argc != 3 || argv[1][0]=='?'){
  16.         printf("%s\n",usage);
  17.         return 5;}
  18.  
  19.     action    method;
  20.     char    output[256];
  21.     int        ret;
  22.  
  23.     method=action(::FindArg(temp,argv[2]));
  24.     switch (method){
  25.         case device:
  26.         ret = dos_comp::get(argv[1],output,dos_comp::device);
  27.         break;
  28.  
  29.         case path:
  30.         ret = dos_comp::get(argv[1],output,dos_comp::path);
  31.         break;
  32.  
  33.         case drawer:
  34.         ret = dos_comp::get(argv[1],output,dos_comp::drawer);
  35.         break;
  36.  
  37.         case name:
  38.         ret = dos_comp::get(argv[1],output,dos_comp::name);
  39.         break;
  40.  
  41.         case extension:
  42.         ret = dos_comp::get(argv[1],output,dos_comp::extension);
  43.         break;
  44.  
  45.         case noext:
  46.         ret = dos_comp::get(argv[1],output,dos_comp::noext);
  47.         break;
  48.  
  49.         default:
  50.         printf("No method available!\n");
  51.         printf("%s\n",usage);
  52.         ret=5;
  53.         break;}
  54.     if (!ret) printf("%s\n",output);
  55.     return ret;
  56. }
  57.